home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / comunic / twft099b.zip / TWLAUNCH.PAS < prev    next >
Pascal/Delphi Source File  |  1993-06-07  |  19KB  |  696 lines

  1. Unit TwLaunch;
  2. {
  3. Copyright (C) 1993 by David Myers.  All rights reserved.  Personal
  4. copying and use of this code permitted.  This source cannot be
  5. sold or distributed for more than the cost of media.
  6. }
  7.  
  8. interface
  9. uses
  10.   Crt,FlyCom,FParser,TwScr,FlyMenu,TwAnsi,TwLine;
  11.  
  12. const
  13.   MaxSectors = 1000;
  14. type
  15.   DistType = RECORD
  16.     Sector, Distance : Integer;
  17.   END;
  18.   SectorArray = ARRAY[1 .. MaxSectors] of byte;
  19.   MaxDistType = ARRAY[ 1 .. 25] of DistType;
  20. var
  21.   MySectors : SectorArray;
  22.   ExternSectors : SectorArray;
  23.   MaxExtern : integer;
  24.   MaxDist : integer;
  25.   MaxDistArray : MaxDistType;
  26.  
  27. Procedure LaunchStuff;
  28.  
  29. implementation
  30. var
  31.   iii : integer;
  32.  
  33. FUNCTION isdigit( var c : char) : boolean;
  34. { If the character is a digit, returns TRUE, otherwise returns FALSE }
  35. BEGIN
  36.   If ((c >= '0') and (c <= '9')) THEN
  37.     isdigit := TRUE
  38.   ELSE isdigit := FALSE;
  39. END;
  40.  
  41.  
  42. Procedure FindUnknownSectors;
  43. var
  44.   i,ec1 : integer;
  45.   tokstr, tok2, S : string;
  46.   P : ParseType;
  47.   toks : integer;
  48.   Loopit : Boolean;
  49.   temp1, temp2, temp3 : Boolean;
  50.  
  51. BEGIN
  52.   NormalVideo;
  53.   tokstr := ' ' +#8+#9+#10+#13;
  54.   tok2 := tokstr + '[';
  55.   Loopit := TRUE;
  56.   for i := 1 to MaxSectors do
  57.     MySectors[i] := 0;
  58.   Async_Send('C');
  59.   REPEAT
  60.     GetALine(toks,tokstr,S,'?',P,Loopit);
  61.   UNTIL ((NOT Loopit) or MatchToken(P.s[toks-1],'?'));
  62.   If Loopit then begin
  63.     Async_Send('K');
  64.     REPEAT
  65.       GetALine(toks,tokstr,S,')',P,Loopit);
  66.     UNTIL ((NOT Loopit) or MatchToken(P.s[toks-1],'(E/U)'));
  67.     if Loopit then begin
  68.       Async_Send('U');
  69.       Async_Send(#13);
  70.       REPEAT
  71.         GetALine(toks,tok2,S,' ]?',P,Loopit);
  72.         if Matchtoken(P.s[toks-1],'Pause]') then
  73.           Async_Send(#13);
  74.  
  75.         If (toks > 0) and isdigit(P.s[0][1]) then begin
  76.           Val(P.s[0],i,ec1);
  77.           if (ec1 = 0) and (i > 0) and (i <= MaxSectors) then
  78.              MySectors[i] := 1;
  79.         end;
  80.       UNTIL ((NOT Loopit) or MatchToken(P.s[toks-1],'?'));
  81.       Async_Send('Q');
  82.     end;
  83.   end;
  84.  
  85. END;
  86.  
  87. Procedure DisplayStuff;
  88. var
  89. X,Y,YY,j : integer;
  90. c : char;
  91. BEGIN
  92.   SaveScreen(X,Y);
  93.   SelectWindow(1);
  94.   TextColor(Yellow);
  95.   TextBackground(Blue);
  96.   ClrScr;
  97.   Write(' UNKNOWN SECTOR DISPLAY ');
  98.   SelectWindow(2);
  99.   ClrScr;
  100.   j := 0;
  101.   While (j < MaxSectors) do begin
  102.     Inc(j);
  103.     If MySectors[j] > 0 then begin
  104.       Write(j : 4);
  105.       YY := WhereY;
  106.       if YY > 21 then begin
  107.         PressEnter(c);
  108.         if c = #27 then j := MaxSectors+1;
  109.         ClrScr;
  110.       end;
  111.     end;
  112.   end;
  113.   PressEnter(c);
  114.   RestoreScreen;
  115.   NormalVideo;
  116.   GotoXY(X,Y);
  117. END;
  118.  
  119. Procedure LaunchEprobe;
  120. type
  121.   PortType = RECORD
  122.     Sector, Class : integer;
  123.   END;
  124.   PortList = ARRAY[1 .. 500] of PortType;
  125.   PlanetList = ARRAY[1 .. 100] of integer;
  126.   SectorArray = ARRAY[1 .. 26] of String;
  127. var
  128.  SA : SectorArray;
  129.  tokstr,inputstr,S : string;
  130.  index,count : integer;
  131.  i,X,Y,YY,low,high,xlow,xhigh,toks,ec1,ec2,temp : integer;
  132.  P : ParseType;
  133.  Planets, ProbeDeath : Planetlist;
  134.  Ports : PortList;
  135.  planetcount, portcount, probedeathcount, currentsector : integer;
  136.  Loopit, isClassZero,isSeen : Boolean;
  137.  
  138. BEGIN
  139.   Loopit := TRUE;
  140.   SaveScreen(X,Y);
  141.   tokstr := ' '+#8+#9+#10+#13;
  142.   TextColor(LightCyan);
  143.   TextBackGround(Blue);
  144.   WFrameW(10,5,45,20);
  145.   ClrScr;
  146.   WriteLn('Enter Sector Numbers of Probes');
  147.   WriteLn('An Empty Line Quits');
  148.   count := 0;
  149.   REPEAT
  150.     BuildString(S);
  151.     toks := Parse_Str(tokstr,S,P);
  152.     if toks = 3 then begin
  153.       Val(P.s[0],low, ec1);
  154.       Val(P.s[2],high,ec2);
  155.       If ((ec1 = 0) and (ec2 = 0)) then begin
  156.         if low > high then begin
  157.           temp := low;
  158.           low := high;
  159.           high := temp;
  160.         end;
  161.         for i := low to high do begin
  162.           if (count < 25) then begin
  163.             inc(count);
  164.             Str(i,SA[count]);
  165.           end;
  166.         end;
  167.         if (count < 25) then begin
  168.           YY := WhereY;
  169.           GotoXY(12,YY);
  170.           WriteLn(' Count : ',count);
  171.         end
  172.         else WriteLn;
  173.       end;
  174.     end
  175.     else begin
  176.       if toks > 0 then begin
  177.         if ((P.s[0][1] = 'U') or (P.s[0][1] = 'u')) then begin
  178.           low := 1;
  179.           S := '';
  180.           if (toks > 1) then begin
  181.             Val(P.s[1],xlow,ec1);
  182.             if (ec1 = 0) then
  183.               if xlow < MaxSectors then
  184.                 low := xlow;
  185.           end;
  186.           for i := low to MaxSectors do begin
  187.             if (MySectors[i] > 0) and (count < 25) then begin
  188.               Inc(count);
  189.               Str(i,SA[count]);
  190.             end;
  191.           end;
  192.           YY := WhereY;
  193.           GotoXY(12,YY);
  194.           WriteLn(' Count : ',count);
  195.         end
  196.         else if ((P.s[0][1] = 'L') or (P.s[0][1] = 'l')) then begin
  197.           high := MaxDist;
  198.           if (toks = 2) then begin
  199.             Val(P.s[1],xhigh,ec1);
  200.             if (ec1 = 0) then
  201.               if (xhigh > 0) and (xhigh < MaxDist) then
  202.                 high := xhigh;
  203.           end;
  204.           if (MaxDist > 0) then
  205.             for i := 1 to high do begin
  206.               if (count < 25) then begin
  207.                 Inc(Count);
  208.                 Str(MaxDistArray[i].Sector,SA[count]);
  209.               end;
  210.             end;
  211.           YY := WhereY;
  212.           GotoXY(12,YY);
  213.           WriteLn(' Count : ',count);
  214.         end
  215.         else begin
  216.           Inc(count);
  217.           SA[count] := S;
  218.           YY := WhereY;
  219.           GotoXY(12,YY);
  220.           WriteLn(' Count : ',count);
  221.         end;
  222.       end
  223.       else WriteLn;
  224.     end;
  225.   UNTIL((S = '') or (count >= 25));
  226.   if (count >= 1) then begin
  227.   for i := 1 to count do begin
  228.     SA[i] := SA[i] + #13;
  229.   end;
  230.   WriteLn('---------------------');
  231.   WriteLn('Final Count = ',count);
  232.   Delay(2000);
  233.   RestoreScreen;
  234.   SelectWindow(1);
  235.   TextColor(White);
  236.   TextBackground(Cyan);
  237.   ClrScr;
  238.   Write(' -----====== ALT-L Eprobe Launch;  Alt-Q Quits =====----- ');
  239.   SelectWindow(2);
  240.   NormalVideo;
  241.   GotoXY(X,Y);
  242.   index := 1;
  243.   planetcount := 0;
  244.   portcount := 0;
  245.   probedeathcount := 0;
  246.   While ((index <= count) and Loopit) do begin
  247.     currentsector := 1;
  248.     Async_Send('E');
  249.     REPEAT
  250.       GetALine(toks,tokstr,inputstr,':',P,Loopit);
  251.     UNTIL ((NOT Loopit) or MatchToken(P.s[toks-1],':'));
  252.     If Loopit then begin
  253.       Delay(1000);
  254.       Async_Send_String(SA[index]);
  255.       Inc(index);
  256.       REPEAT
  257.         GetALine(toks,tokstr,inputstr,'?',P,Loopit);
  258.         If (toks = 5) and MatchToken(P.s[0],'Probe') then begin
  259.           Val(P.s[4],i,ec1);
  260.           if (ec1 = 0) then
  261.             currentsector := i;
  262.         end;
  263.         If MatchToken(P.s[0],'Ports') then begin
  264.         { if we see a port, note it }
  265.           if portcount < 1 then begin
  266.             ISSEEN := FALSE;
  267.           end
  268.           else begin
  269.           { record new ports only }
  270.             isseen := FALSE;
  271.             for i := 1 to portcount do
  272.               if Ports[i].Sector = currentsector then
  273.                 isseen := TRUE;
  274.           end;
  275.           if NOT isseen then begin
  276.             Inc(portcount);
  277.             Ports[portcount].Sector := currentsector;
  278.             Ports[portcount].Class := Ord(P.s[toks-1][1]) - Ord('0');
  279.           end;
  280.         end;
  281.         If MatchToken(P.s[0],'Probe') and MatchToken(P.s[1],'Destroyed!') then begin
  282.         { note any destroyed probes }
  283.           if probedeathcount < 1 then begin
  284.             ISSEEN := FALSE;
  285.           end
  286.           else begin
  287.           { record destruction in new sectors only}
  288.             isseen := FALSE;
  289.             for i := 1 to probedeathcount do
  290.               if ProbeDeath[i] = currentsector then
  291.                 isseen := TRUE;
  292.           end;
  293.           if NOT isseen then begin
  294.             Inc(probedeathcount);
  295.             ProbeDeath[probedeathcount] := currentsector;
  296.           end;
  297.         end;
  298.         If MatchToken(P.s[0],'Planets') then begin
  299.         { record any planets seen }
  300.           if planetcount < 1 then begin
  301.             ISSEEN := FALSE;
  302.           end
  303.           else begin
  304.             isseen := FALSE;
  305.             for i := 1 to planetcount do
  306.               if Planets[i] = currentsector then
  307.                 isseen := TRUE;
  308.           end;
  309.           if NOT isseen then begin
  310.             Inc(planetcount);
  311.             Planets[planetcount] := currentsector;
  312.           end;
  313.         end;
  314.       UNTIL ((NOT Loopit) or MatchToken(P.s[toks-1],'=Help)?'));
  315.     end;
  316.   end;
  317.  
  318.   if probedeathcount > 0 then begin
  319.     SaveScreen(X,Y);
  320.     TextColor(White);
  321.     TextBackGround(Blue);
  322.     WFrameW(10,5,45,20);
  323.     ClrScr;
  324.     WriteLn('Probes Died in These Sectors: ');
  325.     for i := 1 to probedeathcount do
  326.       WriteLn(ProbeDeath[i]);
  327.     WriteLn('-----------------------');
  328.     WriteLn('Press ENTER to continue');
  329.     ReadLn(S);
  330.     SelectWindow(2);
  331.     RestoreScreen;
  332.     NormalVideo;
  333.     GotoXY(X,Y);
  334.   end;
  335.   if (planetcount > 0) then begin
  336.     SaveScreen(X,Y);
  337.     TextColor(Yellow);
  338.     TextBackGround(Blue);
  339.     WFrameW(10,5,45,20);
  340.     ClrScr;
  341.     WriteLn('Planets Found in These Sectors: ');
  342.     for i := 1 to planetcount do
  343.       WriteLn(Planets[i]);
  344.     WriteLn('-----------------------');
  345.     WriteLn('Press ENTER to continue');
  346.     ReadLn(S);
  347.     SelectWindow(2);
  348.     RestoreScreen;
  349.     NormalVideo;
  350.     GotoXY(X,Y);
  351.   end;
  352.   isClassZero := FALSE;
  353.   if (portcount > 0) then
  354.   for i := 1 to portcount do
  355.     if (Ports[i].Class = 0) then
  356.       isClassZero := TRUE;
  357.   if isClassZero then begin
  358.     SaveScreen(X,Y);
  359.     TextColor(White);
  360.     TextBackGround(Red);
  361.     WFrameW(10,5,45,12);
  362.     ClrScr;
  363.     WriteLn('Class Zero Ports Found: ');
  364.     for i := 1 to portcount do
  365.       if Ports[i].Class = 0 then
  366.         WriteLn(Ports[i].Sector);
  367.     WriteLn('-----------------------');
  368.     WriteLn('Press ENTER to continue');
  369.     ReadLn(S);
  370.     SelectWindow(2);
  371.     RestoreScreen;
  372.     NormalVideo;
  373.     GotoXY(X,Y);
  374.   end;
  375.   end { if count }
  376.   else begin
  377.     RestoreScreen;
  378.     SelectWindow(2);
  379.     NormalVideo;
  380.     GotoXY(X,Y);
  381.   end;
  382.   TopLine;
  383.   SaveScreen(X,Y);
  384.   TextColor(Yellow);
  385.   TextBackground(GREEN);
  386.   GoToXY(10,10);WriteLn('                      ');
  387.   GoToXY(10,11);WriteLn(' Exiting EPROBE Macro ');
  388.   GoToXY(10,12);WriteLn('                      ');
  389.   Delay(2000);
  390.   NormalVideo;
  391.   RestoreScreen;
  392.   GoToXY(X,Y);
  393. END;
  394.  
  395. Procedure FindMaxDist;
  396. var
  397.   i,j, jj,maxj,X,Y : integer;
  398.   S : string;
  399.   dist : integer;
  400.   c : char;
  401.   toks : integer;
  402.   P : ParseType;
  403.   tokstr : string;
  404.   Loopit,Done : Boolean;
  405. BEGIN
  406.   X := WhereX; Y := WhereY;
  407.   SelectWindow(1);
  408.   TextColor(WHITE);
  409.   TextBackGround(Green);
  410.   ClrScr;
  411.   Write(' ===== Finding Longest Eprobe Distances. ALT-Q Quits ===== ');
  412.   SelectWindow(2);
  413.   NormalVideo;
  414.   GotoXY(X,Y);
  415.   for i := 1 to 25 do begin
  416.     MaxDistArray[i].Distance := 0;
  417.     MaxDistArray[i].Sector := 0;
  418.   end;
  419.   Loopit := TRUE;
  420.   tokstr := ' >' +#8+#9+#10+#13;
  421.   j := 0;
  422.   MaxDist := 0;
  423.   Async_Send('C');
  424.   REPEAT
  425.     GetALine(toks,tokstr,S,'?',P,Loopit);
  426.   UNTIL ((NOT Loopit) or MatchToken(P.s[toks-1],'?'));
  427.   While (j < MaxSectors) do begin
  428.     Inc(j);
  429.     If MySectors[j] > 0 then begin
  430.       Async_Send('F');
  431.       REPEAT
  432.         GetALine(toks,tokstr,S,'?',P,Loopit);
  433.       UNTIL ((NOT Loopit) or MatchToken(P.s[toks-1],'?'));
  434.       if Loopit then begin
  435.       Async_Send(#13);
  436.       REPEAT
  437.         GetALine(toks,tokstr,S,'?',P,Loopit);
  438.       UNTIL ((NOT Loopit) or MatchToken(P.s[toks-1],'sector?'));
  439.       if Loopit then begin
  440.       Str(j,S);
  441.       S := S + #13;
  442.       Async_Send_String(S);
  443.       REPEAT
  444.         GetALine(toks,tokstr,S,':',P,Loopit);
  445.       UNTIL ((NOT Loopit) or MatchToken(P.s[toks-1],'is:'));
  446.       if Loopit then begin
  447.       dist := 0;
  448.       REPEAT
  449.         GetALine(toks,tokstr,S,' ?',P,Loopit);
  450.         { LastAttr is a global variable created by the ansi driver
  451.           to save the previous screen attributes }
  452.         If isdigit(P.s[0][1]) then
  453.           if ((TextAttr and 15) = LightRed) or
  454.              ((LastAttr and 15) = LightRed) then
  455.             inc(dist);
  456.         If MatchToken(P.s[toks-1],'Avoids?') then begin
  457.           { this "if" should work but it doesn't..}
  458.           Delay(2500);
  459.           Async_Send('N');
  460.           Async_Send(#13);
  461.         end;
  462.       UNTIL ((NOT Loopit) or MatchToken(P.s[toks-1],'?'));
  463.       if Loopit then begin { #4 }
  464.       if (dist > 0) then begin
  465.         Done := FALSE;
  466.         if (MaxDist <= 0) then begin
  467.           Inc(MaxDist);
  468.           MaxDistArray[1].Distance := dist;
  469.           MaxDistArray[1].Sector := j;
  470.         end
  471.         else if (MaxDist < 25) then begin
  472.           i := 0;
  473.           While ( i < MaxDist) and (NOT Done) do begin
  474.             Inc(i);
  475.             if (dist > MaxDistArray[i].Distance) then begin
  476.               Done := TRUE;
  477.               for jj := MaxDist+1 downto i+1 do begin
  478.                  MaxDistArray[jj].Distance := MaxDistArray[jj-1].Distance;
  479.                  MaxDistArray[jj].Sector := MaxDistArray[jj-1].Sector;
  480.               end;
  481.               MaxDistArray[i].Distance := Dist;
  482.               MaxDistArray[i].Sector := j;
  483.               Inc(MaxDist);
  484.             end;
  485.           end;
  486.           if NOT Done then begin
  487.              Inc(MaxDist);
  488.              MaxDistArray[MaxDist].Distance := Dist;
  489.              MaxDistArray[MaxDist].Sector := j;
  490.           end;
  491.         end
  492.         else begin
  493.           i := 0;
  494.           Done := FALSE;
  495.           While ( i < MaxDist) and NOT Done do begin
  496.             Inc(i);
  497.             if dist > MaxDistArray[i].Distance then begin
  498.               Done := TRUE;
  499.               for jj := MaxDist downto i+1 do begin
  500.                  MaxDistArray[jj].Distance := MaxDistArray[jj-1].Distance;
  501.                  MaxDistArray[jj].Sector := MaxDistArray[jj-1].Sector;
  502.               end;
  503.               MaxDistArray[i].Distance := Dist;
  504.               MaxDistArray[i].Sector := j;
  505.               Inc(MaxDist);
  506.             end;
  507.           end;
  508.         end;
  509.       end;
  510.       end; { loopit #4 }
  511.       end; { loopit #3 }
  512.       end; { loopit #2 }
  513.       end; { loopit #1 }
  514.     end;
  515.   end;
  516.   Async_Send('Q');
  517.   TopLine;
  518.   SaveScreen(X,Y);
  519.   TextColor(Yellow);
  520.   TextBackground(Red);
  521.   WFrameW(5,5,45,22);
  522.   ClrScr;
  523.   WriteLn(' The Longest Eprobe Shots Are:');
  524.   If MaxDist > 0 then begin
  525.     maxj := MaxDist;
  526.     if maxj > 12 then maxj := 12;
  527.     for j := 1 to maxj do
  528.       WriteLn('Sector ',MaxDistArray[j].Sector,
  529.               ' Dist: ',MaxDistArray[j].Distance);
  530.   end;
  531.   WriteLn('-----------------');
  532.   WriteLn('Press ENTER ');
  533.   REPEAT
  534.   c := ReadKey;
  535.   UNTIL ((c = #13) or (c = #27));
  536.   RestoreScreen;
  537.   SelectWindow(2);
  538.   NormalVideo;
  539.   GotoXY(X,Y);
  540. END;
  541.  
  542. Procedure LaunchDisruptors;
  543. var
  544.   toks : integer;
  545.   tokstr,S, sector : string;
  546.   P : ParseType;
  547.   nummines : integer;
  548.   Loopit, Done : Boolean;
  549.   X, Y, index : integer;
  550. BEGIN
  551.   tokstr := ' '+#8+#9+#10+#13;
  552.   SaveScreen(X,Y);
  553.   TextColor(White);
  554.   TextBackground(Blue);
  555.   WFrameW(5,5,45,10);
  556.   ClrScr;
  557.   WriteLn(' TWFT Mine Disruptor Launch ');
  558.   Write(' Sector to launch into : ');
  559.   BuildString(sector);
  560.   if (sector <> '') then begin
  561.   sector := sector + #13;
  562.   Write(' Number of  disruptors : ');
  563.   ReadLn(nummines);
  564.   RestoreScreen;
  565.   SelectWindow(1);
  566.   TextColor(White);
  567.   TextBackground(Green);
  568.   ClrScr;
  569.   Write(' ----- ===== +++++ Mine Disruptor Macro - ALT-Q quits +++++ ===== ----- ');
  570.   SelectWindow(2);
  571.   NormalVideo;
  572.   GotoXY(X,Y);
  573.   Loopit := TRUE;
  574.   Async_Send('C');
  575.   REPEAT
  576.     GetALine(toks,tokstr,S,'?',P,Loopit);
  577.   UNTIL ((NOT Loopit) or MatchToken(P.s[toks-1],'?'));
  578.   index := 0;
  579.   Done := FALSE;
  580.   While Loopit and (index < nummines) and (NOT Done) do begin
  581.     Inc(index);
  582.     Async_Send('W');
  583.     REPEAT
  584.       GetALine(toks,tokstr,S,'?',P,Loopit);
  585.     UNTIL ((NOT Loopit) or MatchToken(P.s[toks-1],'?'));
  586.     Async_Send('Y');
  587.     if Loopit then begin
  588.       REPEAT
  589.         GetALine(toks,tokstr,S,')',P,Loopit);
  590.       UNTIL ((NOT Loopit) or MatchToken(P.s[toks-1],'quit)'));
  591.       if Loopit then begin
  592.         Async_Send_String(sector);
  593.         REPEAT
  594.           GetALine(toks,tokstr,S,'?',P,Loopit);
  595.           if (toks > 3) then begin
  596.             If MatchToken(P.s[2],'all') then
  597.               Done := TRUE;
  598.             If MatchToken(P.s[2],'no') then
  599.               Done := TRUE;
  600.           end;
  601.         UNTIL ((NOT Loopit) or MatchToken(P.s[toks-1],'?'));
  602.       end;
  603.     end;
  604.   end; { while }
  605.   if Loopit then
  606.     Async_Send('Q');
  607.   TopLine;
  608.   end { if sector <> '' }
  609.   else begin
  610.     RestoreScreen;
  611.     SelectWindow(2);
  612.     NormalVideo;
  613.     GotoXY(X,Y);
  614.   end;
  615.   SaveScreen(X,Y);
  616.   TextColor(Yellow);
  617.   TextBackground(Red);
  618.   GoToXY(10,10);WriteLn('                              ');
  619.   GoToXY(10,11);WriteLn(' Exiting MINE DISRUPTOR Macro ');
  620.   GoToXY(10,12);WriteLn('                              ');
  621.   Delay(2000);
  622.   NormalVideo;
  623.   RestoreScreen;
  624.   GoToXY(X,Y);
  625. END;
  626.  
  627. Procedure LaunchStuff;
  628. var
  629.   X,Y : integer;
  630.   c : char;
  631.  
  632. BEGIN
  633.   SaveScreen(X,Y);
  634.   REPEAT
  635.     TextColor(LightRed);
  636.     TextBackGround(Black);
  637.     ClrScr;
  638.     GotoXy(22,5); Write('Tradewars Freeware Terminal Launch Menu');
  639.     TextColor(Cyan);
  640.     GotoXy(1,10);Write('A. Eprobe Launch ');
  641.     GotoXy(1,11);Write('B. Collect Unknown Sectors');
  642.     GotoXy(1,12);Write('C. Display Unknown Sectors');
  643.     GotoXy(1,13);Write('D. Find Longest Distances');
  644.     GotoXy(1,14);Write('E. Mine Disruptor Launch');
  645.     GotoXy(1,15);Write('X. Exit');
  646.     TextColor(LightRed);
  647.     GoToXY(1,16);
  648.     c := ReadKey;
  649.     c := UpCase(c);
  650.     Case c of
  651.       'A' : BEGIN
  652.               RestoreScreen;
  653.               GotoXY(X,Y);
  654.               LaunchEprobe;
  655.               SaveScreen(X,Y);
  656.             END;
  657.       'B' : BEGIN
  658.               RestoreScreen;
  659.               GotoXY(X,Y);
  660.               FindUnknownSectors;
  661.               SaveScreen(X,Y);
  662.             END;
  663.       'C' : BEGIN
  664.               RestoreScreen;
  665.               GotoXY(X,Y);
  666.               DisplayStuff;
  667.               SaveScreen(X,Y);
  668.             END;
  669.       'D' : BEGIN
  670.               RestoreScreen;
  671.               GotoXY(X,Y);
  672.               FindMAxDist;
  673.               SaveScreen(X,Y);
  674.             END;
  675.       'E' : BEGIN
  676.               RestoreScreen;
  677.               GotoXY(X,Y);
  678.               LaunchDisruptors;
  679.               SaveScreen(X,Y);
  680.             END;
  681.     else;
  682.     end; { case }
  683.   UNTIL ((c = 'X') or (c = #27));
  684.   RestoreScreen;
  685.   NormalVideo;
  686.   GotoXY(X,Y);
  687. END;
  688.  
  689. BEGIN { unit initialization code }
  690.   for iii := 1 to MaxSectors do begin
  691.     MySectors[iii] := 0;
  692.     ExternSectors[iii] := 0;
  693.   end;
  694.   MaxDist := 0;
  695.   MaxExtern := 0;
  696. END.